<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>资产报表</title>
    <style>
        body {
            font-family: "Microsoft YaHei", sans-serif;
            font-size: 12px;
        }
        
        .header {
            text-align: center;
            margin-bottom: 20px;
        }
        
        .header h1 {
            margin: 0;
            font-size: 20px;
        }
        
        .report-info {
            text-align: right;
            margin-bottom: 20px;
        }
        
        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }
        
        th, td {
            border: 1px solid #000;
            padding: 6px;
            text-align: left;
        }
        
        th {
            background-color: #f2f2f2;
            font-weight: bold;
        }
        
        .text-right {
            text-align: right;
        }
        
        .text-center {
            text-align: center;
        }
        
        .footer {
            margin-top: 30px;
            text-align: right;
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>固定资产报表</h1>
    </div>
    
    <div class="report-info">
        <p>报表生成时间: {{ report_date }}</p>
    </div>
    
    <table>
        <thead>
            <tr>
                <th>资产名称</th>
                <th>资产编号</th>
                <th>资产类别</th>
                <th>所属部门</th>
                <th>位置</th>
                <th>使用人</th>
                <th>状态</th>
                <th>启用日期</th>
                <th>采购价格</th>
            </tr>
        </thead>
        <tbody>
            {% for asset in assets %}
            <tr>
                <td>{{ asset.name }}</td>
                <td>{{ asset.asset_number }}</td>
                <td>{{ asset.category.name|default:'-' }}</td>
                <td>{{ asset.department.name|default:'-' }}</td>
                <td>{{ asset.location.name|default:'-' }}</td>
                <td>{% if asset.user %}{{ asset.user.username }}{% else %}-{% endif %}</td>
                <td>
                    {% if asset.status == 'idle' %}闲置
                    {% elif asset.status == 'in_use' %}在用
                    {% elif asset.status == 'maintenance' %}维修中
                    {% elif asset.status == 'scrapped' %}已报废
                    {% endif %}
                </td>
                <td class="text-center">{{ asset.purchase_date|date:"Y-m-d"|default:'-' }}</td>
                <td class="text-right">¥{{ asset.purchase_price|floatformat:2|default:'-' }}</td>
            </tr>
            {% empty %}
            <tr>
                <td colspan="9" class="text-center">暂无数据</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    
    <div class="footer">
        <p>总计: {{ assets.count }} 条记录</p>
    </div>
</body>
</html>